package com.dh.order.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dh.product.client.Productclient;
import com.dh.product.common.DecreaseStockInput;
import com.dh.product.common.ProductInfoOutput;

import lombok.extern.slf4j.Slf4j;

/**
 * @author 作者 dinghao
 * @version 创建时间：2018年11月15日 下午5:23:04 
 * @Description 类说明:测试feign是否成功
 */

@Slf4j
@RestController
@RequestMapping("/client")
public class ProductclientController {

	@Autowired
	private Productclient productclient;

	@PostMapping("/product/listForOrder")
	public String listForOrder(@RequestBody List<String> productIdList) {
		List<ProductInfoOutput> listForOrder = productclient.listForOrder(productIdList);
		log.info("response={}", listForOrder);
		return "ok";
	}

	@PostMapping("/product/decreaseStock")
	public String decreaseStock(@RequestBody List<DecreaseStockInput> decreaseStockInputs) {
		productclient.decreaseStock(decreaseStockInputs);
		return "ok";
	}

}
